<?php /* Smarty version 2.6.26, created on 2013-10-07 15:16:02
         compiled from ../templates/admin/role_info.html */ ?>
<?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
smarty_core_load_plugins(array('plugins' => array(array('modifier', 'escape', '../templates/admin/role_info.html', 8, false),)), $this); ?>
<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => "../templates/admin/header.html", 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
<form method="POST" action="role.php<?php if ($this->_tpl_vars['action'] != ''): ?>?act=<?php echo $this->_tpl_vars['action']; ?>
<?php else: ?>?act=''<?php endif; ?><?php if ($this->_tpl_vars['user_id'] != ''): ?>&user_id=<?php echo $this->_tpl_vars['user_id']; ?>
<?php endif; ?>" name="theFrom">
<div class="list-div">
<table width="100%">
  <tr>
    <td class="label">角色名</td>
    <td>
      <input type="text" name="username" maxlength="20" value="<?php echo ((is_array($_tmp=$this->_tpl_vars['user']['role_name'])) ? $this->_run_mod_handler('escape', true, $_tmp) : smarty_modifier_escape($_tmp)); ?>
" size="34"/><?php echo $this->_tpl_vars['lang']['require_field']; ?>
</td>
  </tr>
  <tr>
    <td class="label">角色描述</td>
    <td>
    <textarea name="role_desc" cols="31" rows="6"><?php echo ((is_array($_tmp=$this->_tpl_vars['user']['role_desc'])) ? $this->_run_mod_handler('escape', true, $_tmp) : smarty_modifier_escape($_tmp)); ?>
</textarea>
<?php echo $this->_tpl_vars['lang']['require_field']; ?>
</td>
  </tr>
  </table>
<table cellspacing='1' id="list-table">
<?php $_from = $this->_tpl_vars['priv_arr']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['priv']):
?>
 <tr>
  <td width="18%" valign="top" class="first-cell">
    <input name="chkGroup" type="checkbox" value="checkbox" onclick="check('<?php echo $this->_tpl_vars['priv']['priv_list']; ?>
',this);" class="checkbox"><?php echo $this->_tpl_vars['lang'][$this->_tpl_vars['priv']['action_code']]; ?>

  </td>
  <td>
    <?php $_from = $this->_tpl_vars['priv']['priv']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['priv_list'] => $this->_tpl_vars['list']):
?>
    <div style="width:200px;float:left;">
    <label for="<?php echo $this->_tpl_vars['priv_list']; ?>
"><input type="checkbox" name="action_code[]" value="<?php echo $this->_tpl_vars['priv_list']; ?>
" id="<?php echo $this->_tpl_vars['priv_list']; ?>
" class="checkbox" <?php if ($this->_tpl_vars['list']['cando'] == 1): ?> checked="true" <?php endif; ?> onclick="checkrelevance('<?php echo $this->_tpl_vars['list']['relevance']; ?>
', '<?php echo $this->_tpl_vars['priv_list']; ?>
')" title="<?php echo $this->_tpl_vars['list']['relevance']; ?>
"/>
    <?php echo $this->_tpl_vars['lang'][$this->_tpl_vars['list']['action_code']]; ?>
</label>
    </div>
    <?php endforeach; endif; unset($_from); ?>
</td></tr>
<?php endforeach; endif; unset($_from); ?>
  <tr>
    <td align="center" colspan="2" >
      <input type="checkbox" name="checkall" value="checkbox" onclick="checkAll(this.form, this);" class="checkbox" /><?php echo $this->_tpl_vars['lang']['check_all']; ?>

      &nbsp;&nbsp;&nbsp;&nbsp;
      <input type="submit"   name="Submit"   value="保存" class="button" />&nbsp;&nbsp;&nbsp;
      <input type="reset" value="重置" class="button" />
    </td>
  </tr>
</table>
</div>
</form>

<?php echo '
<script language="javascript">
function checkAll(frm, checkbox)
{
  for (i = 0; i < frm.elements.length; i++)
  {
    if (frm.elements[i].name == \'action_code[]\' || frm.elements[i].name == \'chkGroup\')
    {
      frm.elements[i].checked = checkbox.checked;
    }
  }
}

function check(list, obj)
{
  var frm = obj.form;

    for (i = 0; i < frm.elements.length; i++)
    {
      if (frm.elements[i].name == "action_code[]")
      {
          var regx = new RegExp(frm.elements[i].value + "(?!_)", "i");

          if (list.search(regx) > -1) {frm.elements[i].checked = obj.checked;}
      }
    }
}

function checkrelevance(relevance, priv_list)
{
  if(document.getElementById(priv_list).checked && relevance != \'\')
  {
    document.getElementById(relevance).checked=true;
  }
  else
  {
    var ts=document.getElementsByTagName("input");
    
    for (var i=0; i<ts.length;i++)
    {
      var text=ts[i].getAttribute("title");

      if( text == priv_list) 
      {
        document.getElementById(ts[i].value).checked = false;
      }
    }
  }
}
</script>
'; ?>
